home *** CD-ROM | disk | FTP | other *** search
- Path: news.iag.net!news
- From: jatmon@iag.net (John R Buchan)
- Newsgroups: comp.lang.c
- Subject: Re: Comma Delimited function wanted
- Date: 15 Jan 1996 03:05:37 GMT
- Organization: Internet Access Group, Orlando, Florida
- Message-ID: <4dcga1$f52@news.iag.net>
- References: <4d1l42$mb6@voyager.Internex.NET> <4d4gic$p7u@umbc9.umbc.edu> <4d6gi2$g4r@news.iag.net> <821492481snz@genesis.demon.co.uk>
- NNTP-Posting-Host: pm4-orl28.iag.net
- X-Newsreader: WinVN 0.99.7
-
- In article <821492481snz@genesis.demon.co.uk>, fred@genesis.demon.co.uk
- says...
- ->
- ->In article <4d6gi2$g4r@news.iag.net> jatmon@iag.net "John R Buchan" writes:
- ->
- ->> char *buffer = "3740067099,,P03,5000";
- ->>
- ->>A strtok based solution will have a similar problem. A full solution to
- ->>this type of parsing will require a non-standard function (custom code).
- ->
- ->I don't recommend passing pointers to string literals as strtok's first
- ->argument. If a token exists strtok will attempt to modify the string
- ->by null character terminating the token. With string literals this
- ->results in undefined behaviour. better would be:
- ->
- -> static char buffer[] = "3740067099,,P03,5000";
-
- Heh, heh. I wasn't recommending passing this to strtok. I was just making
- the point that strtok would have the same kind of problems with a string of
- this type. However, you are, of course, quite correct.
-
- Actually, I've pointed this out in several other posts this week. I don''t
- know how I managed to miss it here. Oh well, Murphy prevails. :-)
-
- Thanks for the correction.
-
- --
- John R Buchan -:|:- Looking for that elusive FAQ? ftp to:
- jatmon@mail.iag.net -:|:- rtfm.mit.edu /pub/usenet-by-group/....
-
-